(* FreeStack.pas *)

program FreeStack;

uses nodes, stack;

var
   i	: integer;
   t	: link;
   head	: link;
begin
   NodesNr := ReadData('data.in');
   construct(NodesNr);
   head := top;
   for i := 1 to NodesNr do
      begin
	 t := top;    
	 pop();
	 t^.item := NodesTab[i].item;
      end;
   t := head;
   while t^.next <> nil do
   begin
      print(t);
      t := t^.next;
   end; 
end.
